package com.itheima.service.imp;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.itheima.mapper.NursingLevelMapper;
import com.itheima.pojo.Entity;
import com.itheima.pojo.NursingLevel;
import com.itheima.pojo.NursinglevelQueryParam;
import com.itheima.pojo.PageResultwo;
import com.itheima.service.NursingLevelService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NursingLevelServiceImpl implements NursingLevelService {

    @Autowired
    private NursingLevelMapper nursingLevelMapper;


    @Override
    public PageResultwo listwo(NursinglevelQueryParam nursinglevelQueryParam) {
        //1、分页设置
        PageHelper.startPage(nursinglevelQueryParam.getPage(),nursinglevelQueryParam.getPageSize());

        //3、执行查询
        List<NursingLevel> listwo = nursingLevelMapper.listwo(nursinglevelQueryParam);
        Page<NursingLevel> pageList = (Page<NursingLevel>) listwo;

        //4、封装PageResult对象
        return new PageResultwo(pageList.getTotal(),pageList.getResult());
    }


}
